package com.company.JUC;

import java.util.concurrent.CountDownLatch;

public class CountDownLatchDemo {
    public static void main(String[] args) throws InterruptedException {
        //总数是6倒计时
        CountDownLatch countDownLatch = new CountDownLatch(6);
        for (int i=0;i<6;i++){
            new Thread(()->{
                System.out.println(Thread.currentThread().getName());
                //--操作
                countDownLatch.countDown();

            },String.valueOf(i)).start();
        }
        //计数器归零后再向下运行
        countDownLatch.await();
        System.out.println(countDownLatch.toString());
        System.out.println(1111);
    }
}
